package com.landeb.shop.huo.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.landeb.shop.R;
import com.landeb.shop.huo.bean.BeanActShopList;
import com.landeb.shop.huo.view.FixedGridView;

import java.util.List;

/**
 * Created by blade on 2016/12/8.
 */

public class ActShopListLvGvAdapter extends BaseAdapter {

    private List<BeanActShopList.DataBean.ChildBean> mList;
    private Context mContext;
    private LayoutInflater mInflater;

    public ActShopListLvGvAdapter(Context context, List<BeanActShopList.DataBean.ChildBean> list) {
        mContext = context;
        mList = list;
        mInflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public Object getItem(int position) {
        return mList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

      ViewHolder holder = null;
        if (convertView == null) {

            convertView = mInflater.inflate(R.layout.item_act_shop_list_lv_gv, parent, false);

            holder = new ViewHolder();
            holder.mItem = (TextView) convertView.findViewById(R.id.tv_item_act_shop_list_lv_gv);

            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }

        holder.mItem.setText(mList.get(position).getCatename());

        return convertView;
    }

    private class ViewHolder {

        private TextView mItem;

    }
}
